{% extends 'base.html' %}
{% block title %} 查找 {% endblock %}
{% block mycss %}
    <style>
        .box {
            width: 100%;

            border-bottom: 1px dashed lightgray;
        }
        .box div {
            text-align: right;
        }
    </style>
{% endblock %}
{% block bodycontent %}
    <div class="container">
        {% if paginate.items %}
            {% for article in paginate.items %}
                <div class="box">
                    <h3><a href="{{ url_for('blog.detail') }}?articleid={{ article.aid }}" style="color: deepskyblue">{{ article.title }}</a></h3>
                    <p>{{ article.thumb_content }}</p>
                    <div>
                        <span>作者：{{ article.user.uname }}</span>
                        &nbsp;&nbsp;&nbsp;
                        <span>发表时间：{{ article.pudate }}</span>
                        &nbsp;&nbsp;&nbsp;
                        <a href="#">
                            <span class="glyphicon glyphicon-eye-open"></span>
                            <span>{{ article.looknum }}</span>
                        </a>
                        &nbsp;&nbsp;&nbsp;
                        <a href="#">
                            <span class="glyphicon glyphicon-thumbs-up"></span>
                            <span>{{ article.likenum }}</span>
                        </a>
                    </div>
                </div>
            {% endfor %}
            {# 分页按钮#}
            <ul class="pagination btns">
                <li><a href="{{ url_for('blog.search') }}?keyword={{ keyword }}&page={% if not paginate.has_prev %}{{ 1 }}{% else %}{{ paginate.prev_num }}{% endif %}">&laquo;</a></li>
                {# 有几页数据，就显示几页#}
                {% for num in range(1,paginate.pages + 1) %}
                    <li {% if num == paginate.page %} class="active" {% endif %}><a href="{{ url_for('blog.search') }}?keyword={{ keyword }}&page={{ num }}">{{ num }}</a></li>
                {% endfor %}
                <li><a href="{{ url_for('blog.search') }}?keyword={{ keyword }}&page={% if not paginate.has_next %}{{ paginate.pages }}{% else %}{{ paginate.next_num}}{% endif %}">&raquo;</a></li>
            </ul>
        {% else %}
            <p3>么有找到符合您搜索的内容</p3>
        {% endif %}
    </div>
{% endblock %}